package event;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

class MyEvent implements ActionListener{
	
	@Override
	public void actionPerformed(ActionEvent ae) {
		System.out.println("Button Clicked");
		
	}	
}



public class ActionEventEx2 {
	JButton btn1 = new JButton("North");
	JButton btn2 = new JButton("East");
	JButton btn3 = new JButton("Center");
	JButton btn4 = new JButton("South");
	JButton btn5 = new JButton("West");
	
	public ActionEventEx2(){
		JFrame f = new JFrame("Event Text_2");
		f.setBounds(450, 150, 300, 300);
		btn1.setBounds(10, 10, 100, 100);		
		//f.setLayout(null);
		
		f.add(btn1,"North");
		f.add(btn2,"East");
		f.add(btn3,"Center");
		f.add(btn4,"South");
		f.add(btn5,"West");
		f.setVisible(true);
		//JPanel p = new JPanel();
		MyEvent ev = new MyEvent();
		
		btn1.addActionListener(ev);
		btn2.addActionListener(ev);
		btn3.addActionListener(ev);
		btn4.addActionListener(ev);
		btn5.addActionListener(ev);
		
	}
	
	public static void main(String[] args) {
		new ActionEventEx2();

	}

}
